package com.ume.supplier.cn.httputil.http;

import com.google.gson.Gson;
import org.jetbrains.annotations.NotNull;

/**
 * Created by xieshilei on 2018/5/15
 */

public class BaseModel<T> implements Mock {

    private String errorMessage;
    private String returnCode ;
    private T result ;

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public String getReturnCode() {
        return returnCode;
    }

    public void setReturnCode(String returnCode) {
        this.returnCode = returnCode;
    }

    public T getResult() {
        return result;
    }

    public void setResult(T result) {
        this.result = result;
    }


    @NotNull
    @Override
    public Mock getMock() {
        return new Gson().fromJson(mockJson(), getClass());
    }

    @NotNull
    @Override
    public String mockJson() {
        return "{\n" +
                "\t\"returnCode\": 0,\n" +
                "\t\"errorMessage\": \"success\"\n" +
                "}";
    }
}
